package com.sunnada.edu.system.sysLog.controller;
import java.util.HashMap;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.alibaba.fastjson.JSONObject;
import com.sunnada.edu.system.pub.common.BasicController;
import com.sunnada.edu.system.pub.dao.Page;
import com.sunnada.edu.system.pub.service.PubMethods;
import com.sunnada.edu.system.sysLog.bean.SysLog;
import com.sunnada.edu.system.sysLog.service.SysLogService;


/***
 * explain 
 * @author chs 2015-5-12
 * version 1.0
 */
@Controller
@RequestMapping("/syslogController")
public class SysLogController extends BasicController{
	@Resource
	SysLogService syslogService;


	/**用户首页*/
	@RequestMapping("/syslog")
	public String syslog(HttpServletRequest request) { 
		String curr=request.getParameter("curr");
		request.setAttribute("curr", curr);
		String moduleId=request.getParameter("moduleId");
		request.setAttribute("pathValue", PubMethods.getPathValue(moduleId));
		return "system/syslog/syslog";
	}
	/**用户查询*/
	@RequestMapping("/syslogSearch")
	public void syslogSearch(HttpServletRequest request,HttpServletResponse response) { 
		HashMap<String, String> params = new HashMap<String, String>();
		setReqParams(request, SysLog.class, params);
		Page page = new Page(); 
		page.setRowCount(syslogService.getSyslogCots(params));
		page.setPageMap(request, page, params);
		List<?> syslogList = syslogService.findSyslogs(params);
		JSONObject json = new JSONObject();		
		json.put("list", syslogList);
		json.put("params", params); 
		printInfo(response,json);
	}
	
	
}
